package org.javaongems.client.vcl;

import java.util.HashMap;
import java.util.Map;

public class GemsAssembler {
	protected String 	descriptor;
	protected Map 	 	componentSpace = new HashMap();
	protected Container	target;
	
	public GemsAssembler(String desc, Container targ) {
		descriptor = desc;
		target = targ;
	}
	
	public Map add(String name, Component cmp) {
		cmp.setName(name);
		componentSpace.put(name, cmp);
		return componentSpace;
	}
	
	public void realise() {
		JsonComponentReader rdr = new JsonComponentReader();
		rdr.readRootContainer(descriptor, componentSpace, target);
	}
}
